{% extends "AcmeCommonBundle::layout.html.twig" %}

{#% form_theme form 'AcmeRegistBundle:Form:fields.html.twig' %#}

{% block title %}用户注册{% endblock %}

{% block body %}
<script>
$(function () {
	$('a[href="#{{ category_name }}"]').parent('li').addClass('active');
});
{% set entity = { 'parent': 'CmUserInfo', 'child': 'CmUser' } %}
{% render "AcmeSecurityBundle:JsValidator:jsConstraintsGenerator" with { 'form': form, 'options': { 'entity': entity } } %}
{% render "AcmeCommonBundle:University:jsUniversityGenerator" %}
</script>

<form class="form-horizontal" id="{{ form.vars.id }}" action="{{ path('AcmeUserBundle_RegistIndex', { 'category_name': category_name }) }}" method="post" {{ form_enctype(form) }}>
	<div class="tabbable">
		<ul class="nav nav-tabs">
			<li><a href="#student" data-toggle="tab" onclick="location.replace('{{ path('AcmeUserBundle_RegistIndex', { 'category_name': 'student' }) }}');">学生</a></li>
	    	<li><a href="#teacher" data-toggle="tab" onclick="location.replace('{{ path('AcmeUserBundle_RegistIndex', { 'category_name': 'teacher' }) }}');">教师</a></li>
	    	<li><a href="#outsider" data-toggle="tab" onclick="location.replace('{{ path('AcmeUserBundle_RegistIndex', { 'category_name': 'outsider' }) }}');">校外人员</a></li>
		</ul>
		<div class="tab-content">
		    <div class="tab-pane active" id="{{ category_name }}">
		    	<fieldset>
				<legend>账户信息</legend>
					{{ form_row(form.user.username) }}
					{{ form_row(form.user.password) }}
					{{ form_row(form.user.email) }}
				</fieldset>
				{% if category_name != 'outsider' %}
				<fieldset>
				<legend>详细信息</legend>
					{{ form_row(form.name) }}
					{{ form_row(form.gender) }}
					{{ form_row(form.birth) }}
					
					{% if category_name == 'student' %}
					{{ form_row(form.stuNum) }}
					{% endif %}
					
					{{ form_row(form.university) }}
					{{ form_row(form.phone) }}
					{{ form_row(form.qq) }}
					{{ form_row(form.idCard) }}
				</fieldset>
				{% endif %}
		    </div>
    	</div>
    </div>

	<input class="btn" autocomplete="off" type="submit" data-loading-text="提交中..." onclick="$(this).button('loading');" value="立即注册" />
	{{ form_rest(form) }}
</form>
{% endblock %}